<div id="csrsPage">
    <div class="post">
        <h2 class="title">Corporate Social Responsibility (CSR)</h2>
        <div class="entry">
            <script>
                $(function() {
                    $( "#csr_datepicker" ).datepicker({ dateFormat: 'yy-mm-dd' });
                });
            </script>

            <input type="button" value="Add new" onclick="show('#new_csr')"/>


            <?php
       //     if ($this->session->userdata("admin")) {
            ?>
                <input type="button" value="Search" onclick="show('#searchCsrs')"/>
                <input type="button" value="Clear Search" onclick="clearSearch()"/>
            <?php
        //    }
            ?>
            <div id="csrs_result" class="info">
                <?= $message ?>
            </div>
            <script type="text/javascript">
                function searchCsrs(){
                    field=document.getElementById("searchCsrsForm").field.value;
                    search=document.getElementById("searchCsrsForm").search.value;
                    $("#csrsPage").load("<?= base_url(); ?>index.php?/admin_mis/csr/"+field+"/"+search);
                }
                function clearSearch(){
                    $("#csrsPage").load("<?= base_url(); ?>index.php?/admin_mis/csr/");
                }
            </script>
            <div id="new_csr" style="display: none;margin-bottom: 10px;">
                <?php $data['id'] = "doc_form" ?>
                <?= form_open_multipart('mis/saveCsr', $data); ?>
                <table>
                    <tr class="darker"><td class="half">Date participated</td><td><input type="text" class="wide" name="date_parti" value="<?php echo set_value('date_parti'); ?>"  id="csr_datepicker"  /></td> </tr>
                    <tr class="lighter"><td class="half">Nature of events</td><td><textarea class="wide" name="nature_of_eve"><?php echo set_value('nature_of_eve'); ?></textarea> </td> </tr>
                    <tr class="darker"><td class="half">Relationship Manager</td><td><input type="text" class="wide" name="relationship_mgr" value="<?php echo set_value('relationship_mgr'); ?>" /></td> </tr>
                    <tr class="lighter"><td class="half">Partnership/Sponsorship</td><td><input type="text" class="wide" name="partnership" value="<?php echo set_value('partnership'); ?>" /></td> </tr>
                    <tr class="darker"><td class="half">Targets</td><td><textarea  class="wide" name="targets"><?php echo set_value('targets'); ?></textarea> </td> </tr>
                    <tr class="lighter"><td class="half">Impact</td><td><textarea  class="wide" name="impact"><?php echo set_value('impact'); ?></textarea> </td> </tr>
                    <tr class="darker"><td class="half">Outcomes</td><td><textarea  class="wide" name="outcomes"><?php echo set_value('outcomes'); ?></textarea> </td> </tr>
                    <tr class="lighter"><td>File/Image</td><td><input type="file" class="wide"  name="userfile" /></td> </tr>
                    <tr><td colspan="2" style="text-align: right">
                            <input type="submit" value="Submit" />
                            <input type="button" value="Cancel" onclick="hide('#new_csr')"/>
                        </td></tr>
                </table>
                </form>
            </div>
            <div id="searchCsrs" style="display: none;margin-bottom: 10px;">
                <form id="searchCsrsForm">
                    <table>
                        <tr class="darker"><td class="half">Select search criteria</td>
                            <td><select name="field">
                                    <option value='all' >All</option>
                                    <option value='nature_of_eve' >Nature of events</option>
                                    <option value='relationship_mgr'>Relationship manager</option>
                                    <option value='partnership'>Partnership/Sponsorship</option>
                                    <option value='targets'>Targets</option>
                                    <option value='impact'>Impact</option>
                                    <option value='outcomes'>Outcomes</option>
                                    <option value='added_by'> Added by</option>
                                </select></td>
                            <td><input type="text" name="search" class="wide"  value="<?php echo set_value('added_by'); ?>" /></td>
                        </tr>

                        <tr><td colspan="3" style="text-align: right">
                                <input type="button" value="Submit" onclick="searchCsrs()" />
                                <input type="button" value="Cancel" onclick="hide('#searchCsrs')"/>
                            </td></tr>

                    </table>
                </form>
            </div>
            <div id="all_docs">
                <?= $tablet ?>
                <?= $pagina ?>
            </div>

        </div>
    </div>
</div>